package com.supermarket.manage.common.constant;

/**
 * @author Faxon
 * @version 1.0
 * @date 2020-02-26 17:56
 **/
public class RoleConstant {
    /**
     * 管理员角色id
     */
    public static final Long SUPER_MANAGER_ID = 1L;

    /**
     * 管理员角色名称
     */
    public static final String SUPER_MANAGER_NAME = "管理员";

    /**
     * 售货员角色id
     */
    public static final Long SALESPERSON_ID = 2L;

    /**
     * 售货员角色名称
     */
    public static final String SALESPERSON_NAME = "售货员";

    /**
     * 基础角色的buyerId
     */
    public static final String BASE_ROLE_BUYERID = "0000";

    /**
     * 每个用户可添加的角色数量
     */
    public static final Integer MAX_ROLE_COUNT = 5;


    /**
     * 判断是否是基本角色id
     *
     * @param roleId
     * @return 是返回true，否则返回false
     */
    public static Boolean isBaseRoleId(Long roleId) {
        if (!SUPER_MANAGER_ID.equals(roleId) && !SALESPERSON_ID.equals(roleId)) {
            return Boolean.FALSE;
        }
        return Boolean.TRUE;
    }

    /**
     * 判断是否与基本角色名称冲突
     *
     * @param roleName
     * @return
     */
    public static Boolean isConflictWithBaseRoleName(String roleName) {
        if (SUPER_MANAGER_NAME.equals(roleName) || SALESPERSON_NAME.equals(roleName)) {
            return Boolean.TRUE;
        }
        return Boolean.FALSE;
    }
}
